import pydantic

from .units import *

# 执行配置


class Next(pydantic.BaseModel):
    ready_validate_code: tp.List[int] = [0]   # 返回值检查
    step: "Step"

class Step(pydantic.BaseModel):
    name: str
    executor: Executor  # 执行器
    validate_code: tp.List[int] = [0]   # 预期返回值
    next: tp.Optional["Next"] = None
    tag: str = ""

    def __str__(self):
        return f"{self.name}|{self.executor}|预期返回值：{self.validate_code}"


class SingleNSingleMJob(pydantic.BaseModel):
    name: str
    creator: str
    send_list: tp.List[str] = []
    cc_list: tp.List[str] = []
    sche: APSCfg
    first_step: Step
    is_unique: bool
    tag: str = ""
    enable_viztracer: bool = False

    def __str__(self):
        return f"<单节点单模块作业> - {self.name} 由 {self.creator} 创建.\n是否独占: {self.is_unique}."
